const config = require('config');
const cookieParser = require('cookie-parser');

module.exports = {
  get(req, key) {
    if (!req.cookies) return '';

    return req.cookies[key];
  },

  getUserInfo(req) {
    if (!req || !req.signedCookies || !req.signedCookies.ads) return undefined;

    try {
      return JSON.parse(req.signedCookies.ads);
    } catch (err) {
      return undefined;
    }
  },
};
